搬瓦工VPS CentOS 6 升级 openssh

搬瓦工注册链接:https://bandwagonhost.com

1、 下载软件包

openssh下载地址:http://www.openssh.com/

openssl下载地址:http://www.openssl.org/

zlib 下载地址:http://zlib.net/

2、 卸载自带的openssh

1
2
3
4
5
6
7
[root@CentOS tmp]# service sshd stop
Stopping sshd: [ OK ]
[root@CentOS tmp]# rpm -e openssh-server
[root@CentOS tmp]# rpm -e openssh-clients
[root@CentOS tmp]# rpm -e openssh-askpass
[root@CentOS tmp]# rpm -e openssh
[root@CentOS tmp]# rm -rf /etc/ssh

(openssh-askpass软件包用于图形界面下输入口令,有时候没有)

3、 安装

a)安装Zlib

1
2
3
[root@CentOS tmp]# tar -xvf zlib-1.2.8.tar.gz
[root@CentOS tmp]# cd zlib-1.2.8
[root@CentOS zlib-1.2.8]# ./configure --prefix=/usr/local/zlib && make && make install

b)安装openssl

1
2
3
[root@CentOS tmp]# tar -xvf openssl-1.0.1i.tar.gz
[root@CentOS tmp]# cd openssl-1.0.1i
[root@CentOS openssl-1.0.1i]# ./config --prefix=/usr/local/openssl && make && make install

c)安装openssh

1
2
3
[root@CentOS tmp]# tar -xvf openssh-6.6p1.tar.gz
[root@CentOS tmp]# cd openssh-6.6p1
[root@CentOS openssh-6.6p1]# ./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --with-md5-passwords --without-hardening && make && make install

4、 修改配置文件

1
2
3
[root@CentOS openssh-6.6p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd
[root@CentOS openssh-6.6p1]# chmod +x /etc/init.d/sshd
[root@CentOS openssh-6.6p1]# vi /etc/init.d/sshd

SSHD=/usr/sbin/sshd 改为 SSHD=/usr/local/openssh/sbin/sshd
/usr/bin/ssh-keygen -A 改为 /usr/local/openssh/bin/ssh-keygen -A

5、 加入到系统服务

1
2
[root@CentOS openssh-6.6p1]# chkconfig --add sshd
[root@CentOS openssh-6.6p1]# service sshd start